﻿namespace UglyToad.PdfPig.Tests.Geometry
{
    using UglyToad.PdfPig.Core;
    using UglyToad.PdfPig.Geometry;
    using static UglyToad.PdfPig.Core.PdfSubpath;

    public class PdfSubpathLineTests
    {
        private static readonly DoubleComparer DoubleComparer = new DoubleComparer(0.001);
        private static readonly DoubleComparer PreciseDoubleComparer = new DoubleComparer(0.000001);
        private static readonly PointComparer PointComparer = new PointComparer(DoubleComparer);

        private static Line CreateLine(double x1, double y1, double x2, double y2)
        {
            return new Line(new PdfPoint(x1, y1), new PdfPoint(x2, y2));
        }

        #region data
        public static IEnumerable<object[]> LengthData => new[]
        {
            new object[] { new double[] { 190.8371004778927, 195.5590603079521, 835.5537688584745, 90.50342829217284 }, new double[] { 653.2199233841478 } },
            new object[] { new double[] { 186.1201280032434, 466.0112253745279, 103.02506253603583, 732.7907411987937 }, new double[] { 279.42100845933044 } },
            new object[] { new double[] { 695.6713774488983, 473.35313064465043, 891.8249539312077, 471.3261715675039 }, new double[] { 196.1640490250485 } },
            new object[] { new double[] { 245.61796166092697, 417.5772082647122, 310.7968924983532, 390.2894655810555 }, new double[] { 70.66055424265687 } },
            new object[] { new double[] { 904.8925597320072, 170.0378813647443, 729.7456407212313, 563.0690257348186 }, new double[] { 430.290510799178 } },
            new object[] { new double[] { 103.69012119895538, 193.34571872543916, 111.74935749953441, 900.9441932245975 }, new double[] { 707.6443685943418 } },
            new object[] { new double[] { 825.8681573033824, 588.4135011435201, 418.2595797323617, 699.9881960129857 }, new double[] { 422.60343709521004 } },
            new object[] { new double[] { 157.37650392040703, 891.7310493860206, 484.7166518460643, 402.2060091124232 }, new double[] { 588.8856743875319 } },
            new object[] { new double[] { 299.14222909979225, 638.96873623182, 14.75546276665618, 838.5092651161324 }, new double[] { 347.40790942759037 } },
            new object[] { new double[] { 370.7722431151812, 265.1506662936315, 2.667747143338728, 168.02703094991122 }, new double[] { 380.7018787674473 } },
            new object[] { new double[] { 814.6714758631268, 270.2656407106455, 830.0276584983447, 712.2448634553435 }, new double[] { 442.2459108721454 } },
            new object[] { new double[] { 481.44218635329383, 10.01987995763043, 107.80183570357438, 187.20422133755756 }, new double[] { 413.5231583162953 } },
            new object[] { new double[] { 551.9344826964319, 381.09882406841, 101.64836559722168, 115.76575575650038 }, new double[] { 522.6463664774645 } },
            new object[] { new double[] { 121.82216264459255, 113.63262078808812, 453.36582182928163, 200.43826377511022 }, new double[] { 342.71915265996387 } },
            new object[] { new double[] { 565.5586097130778, 364.9452683882004, 684.0498690329932, 690.1818117835786 }, new double[] { 346.1487941550471 } },
            new object[] { new double[] { 697.9367978619123, 883.9046526611218, 774.41712851374, 278.1286157995213 }, new double[] { 610.5848407980336 } },
            new object[] { new double[] { 238.79356839355458, 822.0611612623475, 867.1510615215013, 170.66556045357305 }, new double[] { 905.0687089514596 } },
            new object[] { new double[] { 512.7921689861437, 194.80962312949833, 934.0235366700005, 304.0278809274004 }, new double[] { 435.16030719405177 } },
            new object[] { new double[] { 378.61916213668155, 157.3050943441656, 969.9309333193792, 234.8867585351374 }, new double[] { 596.3795145357188 } },
            new object[] { new double[] { 737.1758351156666, 46.35675591104116, 768.1674878711214, 498.87124837530706 }, new double[] { 453.5745235688473 } },
            new object[] { new double[] { 101.36428548561626, 59.44990596498012, 276.69473812807024, 137.64935970681046 }, new double[] { 191.97896288220866 } },
            new object[] { new double[] { 743.5258306065436, 921.564801193344, 192.97031512030216, 408.8678852251345 }, new double[] { 752.3094464883677 } },
            new object[] { new double[] { 471.0577672814765, 27.088862708520843, 784.6648111116209, 134.9885699569563 }, new double[] { 331.65000341350844 } },
            new object[] { new double[] { 929.1244848744249, 663.4442136188952, 331.9145289570389, 94.80387100429132 }, new double[] { 824.6281408584722 } },
            new object[] { new double[] { 505.80057478119835, 698.1765765874327, 233.38766948344724, 84.98722663992497 }, new double[] { 670.9768772929575 } },
            new object[] { new double[] { 806.369302725176, 230.566437922603, 602.430243108747, 792.1865701899809 }, new double[] { 597.5017263617407 } },
            new object[] { new double[] { 264.1606892577477, 995.8172494421481, 794.0334091199198, 198.62980429025077 }, new double[] { 957.2214592046843 } },
            new object[] { new double[] { 472.04192378853895, 162.67346194887645, 564.1517831158918, 14.043503321895855 }, new double[] { 174.85734410302214 } },
            new object[] { new double[] { 612.659731471288, 612.9370506293178, 797.6205762310365, 17.340954361677706 }, new double[] { 623.6547313886841 } },
            new object[] { new double[] { 641.6670982629627, 903.3231885534251, 214.28748308783275, 482.85643579571826 }, new double[] { 599.5378433775909 } },
            new object[] { new double[] { 709.5781899278792, 192.4269693358448, 602.5254664666547, 548.1811408212083 }, new double[] { 371.51220185843533 } },
            new object[] { new double[] { 222.50066070753272, 493.35475220654155, 821.0200479330013, 137.34330664318728 }, new double[] { 696.3975920814629 } },
            new object[] { new double[] { 485.99726695618784, 850.8173850458037, 791.9771001040855, 308.63594537965855 }, new double[] { 622.5627452808825 } },
            new object[] { new double[] { 299.4805833576227, 282.2495959995641, 977.9264025437416, 234.87623995357555 }, new double[] { 680.0977609389578 } },
            new object[] { new double[] { 618.9772189353536, 454.84016878739385, 590.423864770772, 803.1933349207312 }, new double[] { 349.5214190706609 } },
            new object[] { new double[] { 274.5180110294834, 192.66459338152663, 798.3177911789427, 28.490631069587934 }, new double[] { 548.9255865650861 } },
            new object[] { new double[] { 704.4996092428436, 767.1897571734477, 411.6465294270052, 581.1388872031387 }, new double[] { 346.9551160803521 } },
            new object[] { new double[] { 389.7431457194177, 709.1476391506876, 499.13513770357787, 963.7268373170796 }, new double[] { 277.08694673207833 } },
            new object[] { new double[] { 320.03803277377887, 160.2486130669861, 517.3040340006013, 200.74401200369783 }, new double[] { 201.37962303834055 } },
            new object[] { new double[] { 739.2695984980817, 622.3527391356477, 4.065170618754221, 797.1529250703437 }, new double[] { 755.6987864064448 } },
            new object[] { new double[] { 860.2958333508416, 333.5974936543332, 136.96530096286241, 95.00987753984968 }, new double[] { 761.6633834233266 } },
            new object[] { new double[] { 282.15081529831656, 866.7886695252895, 156.7057946463838, 906.0479845603302 }, new double[] { 131.44484403499595 } },
            new object[] { new double[] { 179.51017318735396, 196.10086192847643, 180.56669634209433, 523.0188790687166 }, new double[] { 326.9197243545927 } },
            new object[] { new double[] { 86.74308100085571, 683.0151475437317, 308.0705994959031, 486.3235615192121 }, new double[] { 296.09702878620135 } },
            new object[] { new double[] { 240.18220283297785, 492.5911405930761, 936.1933362976389, 762.1937366884123 }, new double[] { 746.4027449896652 } },
            new object[] { new double[] { 702.0804791819841, 819.9799731078089, 780.0695986494812, 483.9762626961529 }, new double[] { 344.9359305229241 } },
            new object[] { new double[] { 246.34282694670284, 54.58854476863384, 979.2801420594898, 73.00838507308593 }, new double[] { 733.1687380143688 } },
            new object[] { new double[] { 227.3856855531745, 505.5842483079985, 573.4095211687335, 284.8833891099237 }, new double[] { 410.41608650840163 } },
            new object[] { new double[] { 954.8592611427414, 287.6085707479722, 674.852769572892, 453.6053257067626 }, new double[] { 325.5127616209614 } },
            new object[] { new double[] { 640.469141584807, 710.4327102718037, 879.194433659361, 992.2177047203062 }, new double[] { 369.3136176374001 } },
            new object[] { new double[] { 880.5998080157741, 610.6931993086068, 395.1760263198596, 34.07353773225496 }, new double[] { 753.7416546485867 } },
            new object[] { new double[] { 961.9326903213472, 151.83245734410832, 696.0947897205162, 815.95317451048 }, new double[] { 715.3503451913847 } },
            new object[] { new double[] { 3.9155467688531953, 546.2132751275869, 830.7813781223891, 246.18213110470188 }, new double[] { 879.6168429740618 } },
            new object[] { new double[] { 444.27319450891775, 476.81031830207996, 991.4111726026024, 191.1808286420854 }, new double[] { 617.2067501541718 } },
            new object[] { new double[] { 969.0765570919632, 577.138809775923, 474.36598397698936, 241.1621349225992 }, new double[] { 598.0124389987569 } },
            new object[] { new double[] { 635.9692020912202, 290.25881884054616, 0.31074712311085495, 648.2140501777134 }, new double[] { 729.5160169688453 } },
            new object[] { new double[] { 222.53569185763, 629.2774387978521, 153.98871292117389, 943.8303536935576 }, new double[] { 321.9351248166312 } },
            new object[] { new double[] { 481.5920876489339, 682.7603288254961, 740.5384245491173, 409.66097176520435 }, new double[] { 376.3462026123925 } },
            new object[] { new double[] { 689.2587908005099, 624.3534297021754, 738.5826055579923, 63.19313204361565 }, new double[] { 563.3238130688901 } },
            new object[] { new double[] { 391.2948976479508, 426.4913714964327, 98.2965898932392, 102.97919909317011 }, new double[] { 436.47237488780775 } },
            new object[] { new double[] { 272.4261298230215, 632.3818950634542, 448.0360178188617, 446.7872791972879 }, new double[] { 255.5077184752378 } },
            new object[] { new double[] { 639.4775608981882, 510.8129821281046, 672.819698855375, 16.107654192704324 }, new double[] { 495.82765115635493 } },
            new object[] { new double[] { 555.2713222174989, 620.2366193858473, 69.59371657908686, 644.5422920786804 }, new double[] { 486.28541243153904 } },
            new object[] { new double[] { 368.3203329252472, 338.3532939109004, 367.6980529669451, 857.5734223911275 }, new double[] { 519.2205013781428 } },
            new object[] { new double[] { 83.55589164996024, 837.0224269335133, 42.15500568585606, 482.2949465077161 }, new double[] { 357.135294710348 } },
            new object[] { new double[] { 558.5402675219982, 182.94999465379425, 270.09194546817173, 606.6569704515929 }, new double[] { 512.571981125953 } },
            new object[] { new double[] { 166.83078932985129, 671.1399465888945, 50.8449008448667, 29.777972103999907 }, new double[] { 651.7652250947529 } },
            new object[] { new double[] { 261.387026674993, 358.4967960065069, 536.4045942380387, 278.1298688111906 }, new double[] { 286.5196423547811 } },
            new object[] { new double[] { 374.62458475227953, 967.5325872758127, 299.75874172702646, 16.553397039215657 }, new double[] { 953.9215453667748 } },
            new object[] { new double[] { 589.1367883498552, 975.1255761233041, 191.12961067443834, 315.36273606201826 }, new double[] { 770.5171760622113 } },
            new object[] { new double[] { 943.0156575766946, 403.70697682180844, 514.2409660515976, 32.89430939891413 }, new double[] { 566.8772092911516 } },
            new object[] { new double[] { 998.2752186080078, 2.5096192356099944, 554.3874096707293, 480.41835511738594 }, new double[] { 652.252364315573 } },
            new object[] { new double[] { 849.2755177371154, 825.4003090335679, 647.4340814514295, 821.7265401348636 }, new double[] { 201.87486713256226 } },
            new object[] { new double[] { 180.22219935431826, 437.2105889203756, 623.2243804707304, 166.6490965066021 }, new double[] { 519.0900246114029 } },
            new object[] { new double[] { 666.3729082168118, 219.7312638919139, 759.3260890650042, 700.5985723464253 }, new double[] { 489.76898857531086 } },
            new object[] { new double[] { 457.2382866577055, 826.9383730065374, 177.24350181710037, 565.8131907147441 }, new double[] { 382.8621688870017 } },
            new object[] { new double[] { 403.22893472891053, 185.68424293512587, 230.57271512401834, 238.38084925272773 }, new double[] { 180.51898095669904 } },
            new object[] { new double[] { 251.02320270998558, 367.52402970990903, 469.67191166145204, 622.6472801823553 }, new double[] { 335.99870663109647 } },
            new object[] { new double[] { 457.96968836727405, 241.26763693176633, 775.6178440268818, 510.4350522539501 }, new double[] { 416.35495465428943 } },
            new object[] { new double[] { 166.69177076833296, 984.2463387788379, 136.29637813839923, 67.71293599054162 }, new double[] { 917.0372720450468 } },
            new object[] { new double[] { 259.1265915823515, 95.6956800986336, 646.0319384933817, 575.6226645143806 }, new double[] { 616.4622112009279 } },
            new object[] { new double[] { 489.51563418877953, 530.3793652036015, 539.5577872453925, 453.4419047446674 }, new double[] { 91.78011715187303 } },
            new object[] { new double[] { 812.5685935300381, 117.59769673154341, 841.3763834263098, 445.7597505675051 }, new double[] { 329.42407674082403 } },
            new object[] { new double[] { 827.883352640388, 363.2137956224355, 220.27495864931802, 551.0817346592632 }, new double[] { 635.9892475241642 } },
            new object[] { new double[] { 339.842878036833, 388.8579683364443, 609.4560051342442, 950.6885278933158 }, new double[] { 623.1731829557752 } },
            new object[] { new double[] { 175.6850673470375, 219.84401353034977, 538.1206775115039, 549.2723246601904 }, new double[] { 489.7780963754383 } },
            new object[] { new double[] { 164.15354505065315, 411.7306226046701, 488.0109398829, 514.0520711501401 }, new double[] { 339.6369988973126 } },
            new object[] { new double[] { 331.1166009097187, 185.21418897661113, 655.273447162589, 354.30902412637045 }, new double[] { 365.6100713149616 } },
            new object[] { new double[] { 87.600376581919, 133.86233189432474, 190.92652286643397, 214.45645238771917 }, new double[] { 131.0408515086527 } },
            new object[] { new double[] { 286.07906477049437, 616.1414889737961, 251.96826043260012, 388.9637187640246 }, new double[] { 229.72437017012768 } },
            new object[] { new double[] { 205.5323041182433, 991.3184322293126, 983.3221438365764, 714.5627385247764 }, new double[] { 825.5608692076855 } },
            new object[] { new double[] { 636.0677843486854, 237.48631325628077, 27.985130501105182, 437.8993104743765 }, new double[] { 640.2576695083445 } },
            new object[] { new double[] { 557.7530637854924, 723.3535617757199, 458.7229060702702, 469.6406583982108 }, new double[] { 272.3549329043758 } },
            new object[] { new double[] { 41.53671623761524, 602.5627768446343, 403.9672142330918, 374.7713518027152 }, new double[] { 428.0710212101228 } },
            new object[] { new double[] { 915.7357033058988, 749.0338822692759, 540.0533940330042, 104.21370727875833 }, new double[] { 746.2775995401554 } },
            new object[] { new double[] { 372.30445887367244, 417.6507975175771, 214.47828053385098, 977.6487887122577 }, new double[] { 581.8134174384694 } },
            new object[] { new double[] { 747.130347501469, 370.2077845504025, 835.8876206450757, 847.1181654465094 }, new double[] { 485.0993351287533 } },
            new object[] { new double[] { 263.5335653669142, 10.074111838772826, 113.28436564981669, 384.21878617870664 }, new double[] { 403.1861348714305 } },
            new object[] { new double[] { 198.99073365358387, 797.6403198818113, 932.752537092194, 606.1630086633792 }, new double[] { 758.3336633019279 } },
            new object[] { new double[] { 671.8429943842269, 490.1956406172996, 967.6187397246001, 453.85424440639497 }, new double[] { 297.99998088961553 } }
        };

        public static IEnumerable<object[]> IntersectsWithData => new[]
        {
            new object[]
            {
                CreateLine(477.79792540703556, 391.43174235381895, 710.6564996639408, 508.43872535528266),
                CreateLine(462.2179883647196, 398.4239667550966, 156.8766797526694, 258.81606565315826),
                false
            },
            new object[]
            {
                CreateLine(477.79792540703556, 391.43174235381895, 710.6564996639408, 508.43872535528266),
                CreateLine(59.701904986550815, 629.3812122873761, 551.073919364508, 38.63967753035058),
                false
            },
            new object[]
            {
                CreateLine(477.79792540703556, 391.43174235381895, 710.6564996639408, 508.43872535528266),
                CreateLine(882.7495662828106, 250.69715291948347, 570.3235419552665, 308.41013185571165),
                false
            },
            new object[]
            {
                CreateLine(477.79792540703556, 391.43174235381895, 710.6564996639408, 508.43872535528266),
                CreateLine(881.2619010294721, 182.0774203770964, 194.77750987199815, 429.75542808668297),
                false
            },
            new object[]
            {
                CreateLine(477.79792540703556, 391.43174235381895, 710.6564996639408, 508.43872535528266),
                CreateLine(740.6419908373092, 418.6825282420824, 494.4087426267738, 306.0263067755834),
                false
            },
            new object[]
            {
                CreateLine(477.79792540703556, 391.43174235381895, 710.6564996639408, 508.43872535528266),
                CreateLine(1.950604398728406, 892.9741676921681, 438.61648784655995, 867.8209340211022),
                false
            },
            new object[]
            {
                CreateLine(477.79792540703556, 391.43174235381895, 710.6564996639408, 508.43872535528266),
                CreateLine(286.53629258432545, 799.1222933512493, 839.361377231066, 834.1174045261113),
                false
            },
            new object[]
            {
                CreateLine(477.79792540703556, 391.43174235381895, 710.6564996639408, 508.43872535528266),
                CreateLine(5.425833945556402, 25.41854145729383, 394.6971942743568, 959.7385502937628),
                false
            },
            new object[]
            {
                CreateLine(477.79792540703556, 391.43174235381895, 710.6564996639408, 508.43872535528266),
                CreateLine(765.1701172546759, 991.4077543043677, 412.6875465504621, 234.79662483360931),
                true
            },
            new object[]
            {
                CreateLine(477.79792540703556, 391.43174235381895, 710.6564996639408, 508.43872535528266),
                CreateLine(208.99101581807201, 30.656270581897903, 751.8337537659806, 397.6881763710476),
                false
            },
            new object[]
            {
                CreateLine(702.3518407879247, 953.956180579066, 566.857159232065, 414.97020476063886),
                CreateLine(346.97632127866274, 33.159194194619324, 444.4303082967583, 399.2231557350422),
                false
            },
            new object[]
            {
                CreateLine(702.3518407879247, 953.956180579066, 566.857159232065, 414.97020476063886),
                CreateLine(698.0781667487184, 979.1793693862384, 89.59133529450291, 472.65064896560403),
                false
            },
            new object[]
            {
                CreateLine(702.3518407879247, 953.956180579066, 566.857159232065, 414.97020476063886),
                CreateLine(65.12672323436742, 192.34054631051256, 711.0761393618668, 285.285386194857),
                false
            },
            new object[]
            {
                CreateLine(702.3518407879247, 953.956180579066, 566.857159232065, 414.97020476063886),
                CreateLine(985.858581804223, 229.2300000638925, 807.1229200609266, 799.1257857615135),
                false
            },
            new object[]
            {
                CreateLine(702.3518407879247, 953.956180579066, 566.857159232065, 414.97020476063886),
                CreateLine(831.8568378233549, 282.10531734228306, 193.9077855076625, 102.24809479282482),
                false
            },
            new object[]
            {
                CreateLine(702.3518407879247, 953.956180579066, 566.857159232065, 414.97020476063886),
                CreateLine(75.37090089715315, 947.7699597160556, 881.9109299796824, 383.6600166524152),
                true
            },
            new object[]
            {
                CreateLine(702.3518407879247, 953.956180579066, 566.857159232065, 414.97020476063886),
                CreateLine(699.1331988820378, 549.1618645329031, 178.03162895576685, 420.55776921275555),
                true
            },
            new object[]
            {
                CreateLine(702.3518407879247, 953.956180579066, 566.857159232065, 414.97020476063886),
                CreateLine(571.3221413744643, 933.2198675366226, 422.0141526289206, 656.9782857107092),
                false
            },
            new object[]
            {
                CreateLine(702.3518407879247, 953.956180579066, 566.857159232065, 414.97020476063886),
                CreateLine(110.03940777403032, 568.2027703934414, 812.0421262720457, 357.34119299649603),
                true
            },
            new object[]
            {
                CreateLine(702.3518407879247, 953.956180579066, 566.857159232065, 414.97020476063886),
                CreateLine(635.3746658127311, 898.5442586348647, 352.0467551163494, 959.2585053012982),
                false
            },
            new object[]
            {
                CreateLine(697.9086879935481, 429.5509424111104, 518.0003189109993, 347.1714430060675),
                CreateLine(233.52802073544854, 598.5331081583213, 818.6530151774213, 928.2495168370463),
                false
            },
            new object[]
            {
                CreateLine(697.9086879935481, 429.5509424111104, 518.0003189109993, 347.1714430060675),
                CreateLine(591.9422945685271, 816.8964206035663, 38.27818180990295, 455.9247444945608),
                false
            },
            new object[]
            {
                CreateLine(697.9086879935481, 429.5509424111104, 518.0003189109993, 347.1714430060675),
                CreateLine(777.3521572181987, 14.750820027914946, 669.7879017946951, 53.75961278910313),
                false
            },
            new object[]
            {
                CreateLine(697.9086879935481, 429.5509424111104, 518.0003189109993, 347.1714430060675),
                CreateLine(179.8686801770858, 816.5765250903637, 921.9125203989798, 470.03269487453616),
                false
            },
            new object[]
            {
                CreateLine(697.9086879935481, 429.5509424111104, 518.0003189109993, 347.1714430060675),
                CreateLine(43.43079669514949, 389.5494466863455, 32.2904055000397, 991.7209825889628),
                false
            },
            new object[]
            {
                CreateLine(697.9086879935481, 429.5509424111104, 518.0003189109993, 347.1714430060675),
                CreateLine(371.3096479173319, 992.9189303426164, 648.6129687507889, 232.41605106892794),
                true
            },
            new object[]
            {
                CreateLine(697.9086879935481, 429.5509424111104, 518.0003189109993, 347.1714430060675),
                CreateLine(297.7512551638449, 805.0255267113661, 618.1598369767402, 496.1981583583044),
                false
            },
            new object[]
            {
                CreateLine(697.9086879935481, 429.5509424111104, 518.0003189109993, 347.1714430060675),
                CreateLine(956.5278871844829, 589.9239823268553, 693.9427265759625, 802.1578021015566),
                false
            },
            new object[]
            {
                CreateLine(697.9086879935481, 429.5509424111104, 518.0003189109993, 347.1714430060675),
                CreateLine(545.5118830187195, 194.50389070149544, 884.844360257857, 972.9472207060369),
                true
            },
            new object[]
            {
                CreateLine(697.9086879935481, 429.5509424111104, 518.0003189109993, 347.1714430060675),
                CreateLine(198.0649886947893, 133.64352232345522, 204.89061627359396, 547.994803160516),
                false
            },
            new object[]
            {
                CreateLine(927.8376013360242, 274.18386852303655, 560.9242204165885, 976.0573761541023),
                CreateLine(146.35436765689758, 945.1777056948671, 76.80529743211007, 637.8555070192368),
                false
            },
            new object[]
            {
                CreateLine(927.8376013360242, 274.18386852303655, 560.9242204165885, 976.0573761541023),
                CreateLine(469.4144917550691, 499.9739520487639, 31.56406044332405, 149.66108725037975),
                false
            },
            new object[]
            {
                CreateLine(927.8376013360242, 274.18386852303655, 560.9242204165885, 976.0573761541023),
                CreateLine(891.8830123113746, 179.69075390196588, 962.5585753618964, 132.680004432566),
                false
            },
            new object[]
            {
                CreateLine(927.8376013360242, 274.18386852303655, 560.9242204165885, 976.0573761541023),
                CreateLine(709.4497035227682, 333.23287295545344, 271.145333470316, 196.52379870025726),
                false
            },
            new object[]
            {
                CreateLine(927.8376013360242, 274.18386852303655, 560.9242204165885, 976.0573761541023),
                CreateLine(268.26010252557364, 305.0893287651365, 878.3397376126757, 639.0176554628956),
                true
            },
            new object[]
            {
                CreateLine(927.8376013360242, 274.18386852303655, 560.9242204165885, 976.0573761541023),
                CreateLine(497.2352414960561, 652.7204422355568, 695.5712752563976, 406.2404853324916),
                false
            },
            new object[]
            {
                CreateLine(927.8376013360242, 274.18386852303655, 560.9242204165885, 976.0573761541023),
                CreateLine(567.5907943335096, 150.9580811329001, 39.287794937374, 767.7993458710366),
                false
            },
            new object[]
            {
                CreateLine(927.8376013360242, 274.18386852303655, 560.9242204165885, 976.0573761541023),
                CreateLine(609.5906070281865, 389.2634978761418, 418.715923158105, 364.29585811590135),
                false
            },
            new object[]
            {
                CreateLine(927.8376013360242, 274.18386852303655, 560.9242204165885, 976.0573761541023),
                CreateLine(705.9500644465471, 417.92694451662993, 943.5169336081094, 690.6793177324539),
                true
            },
            new object[]
            {
                CreateLine(927.8376013360242, 274.18386852303655, 560.9242204165885, 976.0573761541023),
                CreateLine(724.3138744783428, 214.65482689130022, 387.8516928793446, 258.00778888857025),
                false
            },
            new object[]
            {
                CreateLine(74.39906247284111, 13.471287156970213, 879.840789421163, 510.6153876643147),
                CreateLine(883.7583586382266, 435.70375099558146, 741.5619417737718, 481.0885254991809),
                true
            },
            new object[]
            {
                CreateLine(74.39906247284111, 13.471287156970213, 879.840789421163, 510.6153876643147),
                CreateLine(896.7360131059222, 581.5081427777317, 943.6449176100937, 526.1913379555514),
                false
            },
            new object[]
            {
                CreateLine(74.39906247284111, 13.471287156970213, 879.840789421163, 510.6153876643147),
                CreateLine(38.770173828551634, 195.86717634457696, 740.3992346771155, 978.1976123326531),
                false
            },
            new object[]
            {
                CreateLine(74.39906247284111, 13.471287156970213, 879.840789421163, 510.6153876643147),
                CreateLine(61.26341020727655, 438.2247744561284, 418.1651356195986, 152.22910516745435),
                true
            },
            new object[]
            {
                CreateLine(74.39906247284111, 13.471287156970213, 879.840789421163, 510.6153876643147),
                CreateLine(105.35744720528496, 766.1757897106233, 910.8911673854183, 276.70319307368294),
                true
            },
            new object[]
            {
                CreateLine(74.39906247284111, 13.471287156970213, 879.840789421163, 510.6153876643147),
                CreateLine(226.7699961671722, 171.6188155029713, 189.23740055022176, 566.3637922141064),
                false
            },
            new object[]
            {
                CreateLine(74.39906247284111, 13.471287156970213, 879.840789421163, 510.6153876643147),
                CreateLine(304.7901081443992, 870.690253453218, 800.466258338743, 293.39401110723173),
                true
            },
            new object[]
            {
                CreateLine(74.39906247284111, 13.471287156970213, 879.840789421163, 510.6153876643147),
                CreateLine(889.7513022540523, 773.689627300818, 887.5118246071389, 853.4811241489107),
                false
            },
            new object[]
            {
                CreateLine(74.39906247284111, 13.471287156970213, 879.840789421163, 510.6153876643147),
                CreateLine(152.6495300002486, 251.40321782303866, 41.2134788797206, 6.061632972281683),
                false
            },
            new object[]
            {
                CreateLine(74.39906247284111, 13.471287156970213, 879.840789421163, 510.6153876643147),
                CreateLine(943.6179267380304, 989.8194268233793, 707.9229462189486, 978.6229193626659),
                false
            }
        };

        public static IEnumerable<object[]> IntersectData = new[]
        {
            new object[]
            {
                CreateLine(544.4758354192281, 693.4916838374191, 714.2436809464458, 726.4935962197459),
                CreateLine(574.2127482651124, 875.4428340166585, 508.25571522777057, 77.79697812601749),
                new PdfPoint(559.4072908556284, 696.3942746226318)
            },
            new object[]
            {
                CreateLine(544.4758354192281, 693.4916838374191, 714.2436809464458, 726.4935962197459),
                CreateLine(364.57113459345516, 86.8754168249013, 389.4295296471665, 100.37622121914136),
                null
            },
            new object[]
            {
                CreateLine(544.4758354192281, 693.4916838374191, 714.2436809464458, 726.4935962197459),
                CreateLine(571.8088622784596, 354.4388468017526, 823.2994597010068, 583.4830528874076),
                null
            },
            new object[]
            {
                CreateLine(544.4758354192281, 693.4916838374191, 714.2436809464458, 726.4935962197459),
                CreateLine(811.6248512803021, 813.9401077186392, 266.64980122792116, 707.2423477416153),
                null
            },
            new object[]
            {
                CreateLine(544.4758354192281, 693.4916838374191, 714.2436809464458, 726.4935962197459),
                CreateLine(379.92060432309705, 501.147549697763, 901.1838102927261, 382.17191921443737),
                null
            },
            new object[]
            {
                CreateLine(544.4758354192281, 693.4916838374191, 714.2436809464458, 726.4935962197459),
                CreateLine(805.9976812138625, 378.19372315527, 209.13555684156282, 965.6314624378465),
                null
            },
            new object[]
            {
                CreateLine(544.4758354192281, 693.4916838374191, 714.2436809464458, 726.4935962197459),
                CreateLine(370.9264310228841, 916.9697230064895, 922.1554536729137, 612.9923150400033),
                null
            },
            new object[]
            {
                CreateLine(544.4758354192281, 693.4916838374191, 714.2436809464458, 726.4935962197459),
                CreateLine(479.6619789476819, 688.0986447194141, 393.34107103994995, 681.6366781494353),
                null
            },
            new object[]
            {
                CreateLine(544.4758354192281, 693.4916838374191, 714.2436809464458, 726.4935962197459),
                CreateLine(506.79468175326605, 890.8908102791996, 884.3055769479257, 485.9869926813793),
                new PdfPoint(668.3820466087185, 717.5783529743379)
            },
            new object[]
            {
                CreateLine(544.4758354192281, 693.4916838374191, 714.2436809464458, 726.4935962197459),
                CreateLine(388.58160199747573, 802.479456993506, 418.6054011230613, 305.7989667779905),
                null
            },
            new object[]
            {
                CreateLine(969.4105179577638, 295.816057429671, 4.9178142626167265, 673.6174775048896),
                CreateLine(212.50389515317391, 912.3645502520616, 607.5604126511843, 109.06075736451959),
                new PdfPoint(407.4631429311943, 515.9364538610822)
            },
            new object[]
            {
                CreateLine(969.4105179577638, 295.816057429671, 4.9178142626167265, 673.6174775048896),
                CreateLine(810.8691895441154, 950.4258641325182, 123.70854364466022, 265.5038530354861),
                new PdfPoint(384.1295473952447, 525.0764561598751)
            },
            new object[]
            {
                CreateLine(969.4105179577638, 295.816057429671, 4.9178142626167265, 673.6174775048896),
                CreateLine(461.1617279371427, 501.78428487506744, 531.0894826881109, 813.2188914254496),
                null
            },
            new object[]
            {
                CreateLine(969.4105179577638, 295.816057429671, 4.9178142626167265, 673.6174775048896),
                CreateLine(909.0402093282391, 702.2777256587813, 88.28340307769744, 132.6423341223022),
                new PdfPoint(556.4588917795286, 457.573331688762)
            },
            new object[]
            {
                CreateLine(969.4105179577638, 295.816057429671, 4.9178142626167265, 673.6174775048896),
                CreateLine(377.8493694927715, 227.385745396967, 418.92259438301795, 777.1925717753552),
                new PdfPoint(399.6345849695852, 519.0029781631384)
            },
            new object[]
            {
                CreateLine(969.4105179577638, 295.816057429671, 4.9178142626167265, 673.6174775048896),
                CreateLine(700.8920714128235, 828.464586345776, 100.68315090679758, 295.82522335263616),
                new PdfPoint(366.70705038493276, 531.9010221586993)
            },
            new object[]
            {
                CreateLine(969.4105179577638, 295.816057429671, 4.9178142626167265, 673.6174775048896),
                CreateLine(319.4250093588353, 111.45791989056475, 252.11399140271718, 43.32172214792529),
                null
            },
            new object[]
            {
                CreateLine(969.4105179577638, 295.816057429671, 4.9178142626167265, 673.6174775048896),
                CreateLine(591.585673880949, 919.4816279155633, 916.4150785297255, 267.07553018029205),
                new PdfPoint(885.7984452953025, 328.5677409481548)
            },
            new object[]
            {
                CreateLine(969.4105179577638, 295.816057429671, 4.9178142626167265, 673.6174775048896),
                CreateLine(560.3345894979344, 648.4475307057808, 218.716237925059, 221.14657713319153),
                new PdfPoint(443.20243664412754, 501.937015746619)
            },
            new object[]
            {
                CreateLine(969.4105179577638, 295.816057429671, 4.9178142626167265, 673.6174775048896),
                CreateLine(825.0800008273096, 624.5580268908368, 192.518309745625, 610.4715086253449),
                null
            },
            new object[]
            {
                CreateLine(595.9834685705534, 146.36282869969952, 392.9980471938308, 750.3240669188248),
                CreateLine(153.23496161928364, 404.8319576860848, 412.280081298786, 926.4903905134738),
                null
            },
            new object[]
            {
                CreateLine(595.9834685705534, 146.36282869969952, 392.9980471938308, 750.3240669188248),
                CreateLine(607.2083579771194, 559.6868388699588, 178.04470113686688, 655.0643827657572),
                new PdfPoint(444.94978761963046, 595.7472640016737)
            },
            new object[]
            {
                CreateLine(595.9834685705534, 146.36282869969952, 392.9980471938308, 750.3240669188248),
                CreateLine(738.2309268294287, 210.79306406255805, 957.2434613086579, 153.87647415620788),
                null
            },
            new object[]
            {
                CreateLine(595.9834685705534, 146.36282869969952, 392.9980471938308, 750.3240669188248),
                CreateLine(86.41485459975917, 239.39271770356874, 589.8948478797403, 193.64623385066093),
                new PdfPoint(579.7831990665089, 194.56498411945967)
            },
            new object[]
            {
                CreateLine(595.9834685705534, 146.36282869969952, 392.9980471938308, 750.3240669188248),
                CreateLine(75.73631259691527, 266.38683530429495, 662.1471302110343, 126.64391384559592),
                null
            },
            new object[]
            {
                CreateLine(595.9834685705534, 146.36282869969952, 392.9980471938308, 750.3240669188248),
                CreateLine(437.01872665065923, 588.3858466344236, 146.73316635434318, 418.8098707698554),
                null
            },
            new object[]
            {
                CreateLine(595.9834685705534, 146.36282869969952, 392.9980471938308, 750.3240669188248),
                CreateLine(422.8771972938813, 304.405907334938, 365.88939173863224, 990.1393595577989),
                null
            },
            new object[]
            {
                CreateLine(595.9834685705534, 146.36282869969952, 392.9980471938308, 750.3240669188248),
                CreateLine(221.8448505998073, 302.7362566912951, 497.8784142190247, 975.7872588730171),
                new PdfPoint(398.58868984790814, 733.6897124075681)
            },
            new object[]
            {
                CreateLine(595.9834685705534, 146.36282869969952, 392.9980471938308, 750.3240669188248),
                CreateLine(945.8120364753091, 739.4148452821415, 775.9688128275277, 587.5392569574676),
                null
            },
            new object[]
            {
                CreateLine(595.9834685705534, 146.36282869969952, 392.9980471938308, 750.3240669188248),
                CreateLine(279.0912195381171, 964.4648424885868, 978.7513649874946, 796.0536898333239),
                null
            },
            new object[]
            {
                CreateLine(696.7452862191581, 759.7293110156866, 833.4735189170325, 755.7397942068486),
                CreateLine(69.37596113190847, 76.69713033738057, 867.409813413614, 326.60773065914793),
                null
            },
            new object[]
            {
                CreateLine(696.7452862191581, 759.7293110156866, 833.4735189170325, 755.7397942068486),
                CreateLine(371.14179279327266, 883.1261953844328, 454.608295589507, 680.8566913007386),
                null
            },
            new object[]
            {
                CreateLine(696.7452862191581, 759.7293110156866, 833.4735189170325, 755.7397942068486),
                CreateLine(588.9787143922464, 766.7434622777022, 466.7476276469411, 521.2059104522621),
                null
            },
            new object[]
            {
                CreateLine(696.7452862191581, 759.7293110156866, 833.4735189170325, 755.7397942068486),
                CreateLine(188.9369465707017, 352.0516924174071, 427.4528500771143, 190.01347842429374),
                null
            },
            new object[]
            {
                CreateLine(696.7452862191581, 759.7293110156866, 833.4735189170325, 755.7397942068486),
                CreateLine(990.3129546302623, 156.4289324948156, 178.72015121688412, 932.3749304482398),
                null
            },
            new object[]
            {
                CreateLine(696.7452862191581, 759.7293110156866, 833.4735189170325, 755.7397942068486),
                CreateLine(638.3979381961781, 848.1746249964232, 155.13312908295018, 349.22211742183794),
                null
            },
            new object[]
            {
                CreateLine(696.7452862191581, 759.7293110156866, 833.4735189170325, 755.7397942068486),
                CreateLine(637.5744051594864, 289.0252390733532, 695.0556868453475, 224.81571711203497),
                null
            },
            new object[]
            {
                CreateLine(696.7452862191581, 759.7293110156866, 833.4735189170325, 755.7397942068486),
                CreateLine(287.0471506992456, 994.8815084214126, 610.8608407807641, 453.7316799165901),
                null
            },
            new object[]
            {
                CreateLine(696.7452862191581, 759.7293110156866, 833.4735189170325, 755.7397942068486),
                CreateLine(421.5581219022476, 780.0845078261253, 142.76546887568497, 247.18495332247926),
                null
            },
            new object[]
            {
                CreateLine(696.7452862191581, 759.7293110156866, 833.4735189170325, 755.7397942068486),
                CreateLine(22.450089792698023, 819.8352273877229, 80.02479154120323, 904.3213084151395),
                null
            },
            new object[]
            {
                CreateLine(871.417200574529, 833.491219526598, 234.93640601258093, 884.649724356149),
                CreateLine(272.5815589336167, 87.06143297623115, 682.8817389294783, 470.9248164438085),
                null
            },
            new object[]
            {
                CreateLine(871.417200574529, 833.491219526598, 234.93640601258093, 884.649724356149),
                CreateLine(320.9049845226111, 888.658452454194, 517.8731194792342, 703.6010779299063),
                new PdfPoint(333.61359923444326, 876.7183339526388)
            },
            new object[]
            {
                CreateLine(871.417200574529, 833.491219526598, 234.93640601258093, 884.649724356149),
                CreateLine(165.62306632787593, 688.0034459735028, 60.53922405557732, 327.85128172756185),
                null
            },
            new object[]
            {
                CreateLine(871.417200574529, 833.491219526598, 234.93640601258093, 884.649724356149),
                CreateLine(889.3160894769284, 566.8978657339098, 881.6774867213692, 443.40715221980054),
                null
            },
            new object[]
            {
                CreateLine(871.417200574529, 833.491219526598, 234.93640601258093, 884.649724356149),
                CreateLine(563.1181088252872, 594.8046310996899, 152.38853743027113, 896.5929915277305),
                null
            },
            new object[]
            {
                CreateLine(871.417200574529, 833.491219526598, 234.93640601258093, 884.649724356149),
                CreateLine(146.28779714052308, 25.085468923568442, 196.96581815624114, 598.9096778984109),
                null
            },
            new object[]
            {
                CreateLine(871.417200574529, 833.491219526598, 234.93640601258093, 884.649724356149),
                CreateLine(988.3054602392245, 734.9040180514684, 588.7131758740184, 482.99652191776545),
                null
            },
            new object[]
            {
                CreateLine(871.417200574529, 833.491219526598, 234.93640601258093, 884.649724356149),
                CreateLine(847.5904967749002, 594.253408466906, 606.7953669384582, 46.325485633206156),
                null
            },
            new object[]
            {
                CreateLine(871.417200574529, 833.491219526598, 234.93640601258093, 884.649724356149),
                CreateLine(451.9222008713352, 490.23186369000473, 15.484872447343644, 495.3223297275571),
                null
            },
            new object[]
            {
                CreateLine(871.417200574529, 833.491219526598, 234.93640601258093, 884.649724356149),
                CreateLine(687.1977685068985, 554.1673144161504, 862.2246997537454, 821.2214152471864),
                null
            },
            new object[]
            {
                CreateLine(23.023446349156984, 359.1455482472399, 990.6830879942731, 193.04115058317694),
                CreateLine(822.4594506067639, 539.8596529655376, 641.190005601656, 350.9437296424646),
                null
            },
            new object[]
            {
                CreateLine(23.023446349156984, 359.1455482472399, 990.6830879942731, 193.04115058317694),
                CreateLine(607.2250488535323, 285.8155908923856, 260.8339310264589, 567.9843330262266),
                null
            },
            new object[]
            {
                CreateLine(23.023446349156984, 359.1455482472399, 990.6830879942731, 193.04115058317694),
                CreateLine(450.2299390810893, 512.2113565705253, 707.3896725650907, 114.62666115832954),
                new PdfPoint(614.9544660663089, 257.53715077224086)
            },
            new object[]
            {
                CreateLine(23.023446349156984, 359.1455482472399, 990.6830879942731, 193.04115058317694),
                CreateLine(738.4076549380368, 578.0046933614614, 790.7383911438134, 211.8623218664587),
                new PdfPoint(788.4672701511939, 227.75267018718364)
            },
            new object[]
            {
                CreateLine(23.023446349156984, 359.1455482472399, 990.6830879942731, 193.04115058317694),
                CreateLine(87.09614125022757, 606.3501731536531, 893.4977976921467, 590.6761411509807),
                null
            },
            new object[]
            {
                CreateLine(23.023446349156984, 359.1455482472399, 990.6830879942731, 193.04115058317694),
                CreateLine(126.7428546276751, 2.214352753236226, 645.166346906512, 533.5847540151798),
                new PdfPoint(410.1448418979031, 292.69391229683976)
            },
            new object[]
            {
                CreateLine(23.023446349156984, 359.1455482472399, 990.6830879942731, 193.04115058317694),
                CreateLine(489.23671467660455, 746.5025985356115, 586.0397321190742, 953.3667524815573),
                null
            },
            new object[]
            {
                CreateLine(23.023446349156984, 359.1455482472399, 990.6830879942731, 193.04115058317694),
                CreateLine(890.0249646355987, 387.81550640289373, 455.36468900522533, 973.6439535017472),
                null
            },
            new object[]
            {
                CreateLine(23.023446349156984, 359.1455482472399, 990.6830879942731, 193.04115058317694),
                CreateLine(961.3592658977324, 517.8462344387393, 287.9023168698226, 21.214192392182362),
                new PdfPoint(609.6113559261839, 258.45432666062385)
            },
            new object[]
            {
                CreateLine(23.023446349156984, 359.1455482472399, 990.6830879942731, 193.04115058317694),
                CreateLine(632.106186634677, 148.3555298649517, 150.63470263500534, 654.5063073976717),
                new PdfPoint(511.32724548827554, 275.32536505226557)
            }
        };

        public static IEnumerable<object[]> ContainsData => new[]
        {
            new object[]
            {
                CreateLine(792.302568255538, 386.7128076397761, 29.837927186809775, 143.19608294889696),
                new PdfPoint(420.2624292274015, 74.40282754084848),
                false
            },
            new object[]
            {
                CreateLine(792.302568255538, 386.7128076397761, 29.837927186809775, 143.19608294889696),
                new PdfPoint(1384.648045561307, 575.8967025372106),
                false
            },
            new object[]
            {
                CreateLine(792.302568255538, 386.7128076397761, 29.837927186809775, 143.19608294889696),
                new PdfPoint(604.3641391846478, 462.9990746797793),
                false
            },
            new object[]
            {
                CreateLine(792.302568255538, 386.7128076397761, 29.837927186809775, 143.19608294889696),
                new PdfPoint(1410.8028699789866, 584.2500566916156),
                false
            },
            new object[]
            {
                CreateLine(792.302568255538, 386.7128076397761, 29.837927186809775, 143.19608294889696),
                new PdfPoint(746.9449436320562, 88.10983123761007),
                false
            },
            new object[]
            {
                CreateLine(792.302568255538, 386.7128076397761, 29.837927186809775, 143.19608294889696),
                new PdfPoint(696.8664384808742, 356.2323204301339),
                true
            },
            new object[]
            {
                CreateLine(792.302568255538, 386.7128076397761, 29.837927186809775, 143.19608294889696),
                new PdfPoint(299.5864659689381, 793.8739415583392),
                false
            },
            new object[]
            {
                CreateLine(792.302568255538, 386.7128076397761, 29.837927186809775, 143.19608294889696),
                new PdfPoint(1164.8942605379705, 505.71151743499047),
                false
            },
            new object[]
            {
                CreateLine(792.302568255538, 386.7128076397761, 29.837927186809775, 143.19608294889696),
                new PdfPoint(937.813086690602, 510.5348004408937),
                false
            },
            new object[]
            {
                CreateLine(792.302568255538, 386.7128076397761, 29.837927186809775, 143.19608294889696),
                new PdfPoint(1103.7168112063896, 486.1726020758638),
                false
            },
            new object[]
            {
                CreateLine(868.1583266777006, 602.569446156739, 469.0291583310245, 907.1015953164891),
                new PdfPoint(48.52802828619895, 355.191113196728),
                false
            },
            new object[]
            {
                CreateLine(868.1583266777006, 602.569446156739, 469.0291583310245, 907.1015953164891),
                new PdfPoint(514.2058548965318, 872.6321613885681),
                true
            },
            new object[]
            {
                CreateLine(868.1583266777006, 602.569446156739, 469.0291583310245, 907.1015953164891),
                new PdfPoint(303.2651675583198, 376.7951031839938),
                false
            },
            new object[]
            {
                CreateLine(868.1583266777006, 602.569446156739, 469.0291583310245, 907.1015953164891),
                new PdfPoint(1155.0775016788002, 383.65256428572013),
                false
            },
            new object[]
            {
                CreateLine(868.1583266777006, 602.569446156739, 469.0291583310245, 907.1015953164891),
                new PdfPoint(403.8220598040744, 934.4662191524329),
                false
            },
            new object[]
            {
                CreateLine(868.1583266777006, 602.569446156739, 469.0291583310245, 907.1015953164891),
                new PdfPoint(761.365620172029, 684.0513698193834),
                true
            },
            new object[]
            {
                CreateLine(868.1583266777006, 602.569446156739, 469.0291583310245, 907.1015953164891),
                new PdfPoint(756.2371986521053, 815.1913496835386),
                false
            },
            new object[]
            {
                CreateLine(868.1583266777006, 602.569446156739, 469.0291583310245, 907.1015953164891),
                new PdfPoint(10.03108010421984, 1257.3132117754344),
                false
            },
            new object[]
            {
                CreateLine(868.1583266777006, 602.569446156739, 469.0291583310245, 907.1015953164891),
                new PdfPoint(344.6994817449378, 633.8021658820898),
                false
            },
            new object[]
            {
                CreateLine(868.1583266777006, 602.569446156739, 469.0291583310245, 907.1015953164891),
                new PdfPoint(1041.8730237338066, 470.02661483657494),
                false
            },
            new object[]
            {
                CreateLine(979.3899955779276, 134.51515645288237, 503.1785686319844, 238.20181210595769),
                new PdfPoint(504.80153951872296, 710.167796679677),
                false
            },
            new object[]
            {
                CreateLine(979.3899955779276, 134.51515645288237, 503.1785686319844, 238.20181210595769),
                new PdfPoint(208.10672690932748, 302.4485116062803),
                false
            },
            new object[]
            {
                CreateLine(979.3899955779276, 134.51515645288237, 503.1785686319844, 238.20181210595769),
                new PdfPoint(404.34010595783633, 458.4138987953492),
                false
            },
            new object[]
            {
                CreateLine(979.3899955779276, 134.51515645288237, 503.1785686319844, 238.20181210595769),
                new PdfPoint(926.5118968971191, 146.02843164803784),
                true
            },
            new object[]
            {
                CreateLine(979.3899955779276, 134.51515645288237, 503.1785686319844, 238.20181210595769),
                new PdfPoint(220.1900534884329, 827.0725855605139),
                false
            },
            new object[]
            {
                CreateLine(979.3899955779276, 134.51515645288237, 503.1785686319844, 238.20181210595769),
                new PdfPoint(388.7526433254975, 263.1160431464174),
                false
            },
            new object[]
            {
                CreateLine(979.3899955779276, 134.51515645288237, 503.1785686319844, 238.20181210595769),
                new PdfPoint(959.3050923794631, 246.108863108223),
                false
            },
            new object[]
            {
                CreateLine(979.3899955779276, 134.51515645288237, 503.1785686319844, 238.20181210595769),
                new PdfPoint(84.57840148966045, 329.3446300453785),
                false
            },
            new object[]
            {
                CreateLine(979.3899955779276, 134.51515645288237, 503.1785686319844, 238.20181210595769),
                new PdfPoint(734.5331314857646, 697.979646242439),
                false
            },
            new object[]
            {
                CreateLine(979.3899955779276, 134.51515645288237, 503.1785686319844, 238.20181210595769),
                new PdfPoint(666.8153518569441, 202.57278299332927),
                true
            },
            new object[]
            {
                CreateLine(727.3198688615279, 613.0950626342508, 79.82565194164305, 816.8807283411466),
                new PdfPoint(392.45001176591086, 933.5284257172391),
                false
            },
            new object[]
            {
                CreateLine(727.3198688615279, 613.0950626342508, 79.82565194164305, 816.8807283411466),
                new PdfPoint(1075.1843629410016, 503.61177205136465),
                false
            },
            new object[]
            {
                CreateLine(727.3198688615279, 613.0950626342508, 79.82565194164305, 816.8807283411466),
                new PdfPoint(473.9390481235413, 701.9858235114015),
                false
            },
            new object[]
            {
                CreateLine(727.3198688615279, 613.0950626342508, 79.82565194164305, 816.8807283411466),
                new PdfPoint(135.4036183536137, 799.3886912110291),
                true
            },
            new object[]
            {
                CreateLine(727.3198688615279, 613.0950626342508, 79.82565194164305, 816.8807283411466),
                new PdfPoint(345.3899152286115, 385.71716693563974),
                false
            },
            new object[]
            {
                CreateLine(727.3198688615279, 613.0950626342508, 79.82565194164305, 816.8807283411466),
                new PdfPoint(376.968286004618, 723.3611139413839),
                true
            },
            new object[]
            {
                CreateLine(727.3198688615279, 613.0950626342508, 79.82565194164305, 816.8807283411466),
                new PdfPoint(366.5314920135977, 458.3531866776565),
                false
            },
            new object[]
            {
                CreateLine(727.3198688615279, 613.0950626342508, 79.82565194164305, 816.8807283411466),
                new PdfPoint(695.0160508896901, 623.2620338260258),
                true
            },
            new object[]
            {
                CreateLine(727.3198688615279, 613.0950626342508, 79.82565194164305, 816.8807283411466),
                new PdfPoint(92.49556589124674, 530.8741544723712),
                false
            },
            new object[]
            {
                CreateLine(727.3198688615279, 613.0950626342508, 79.82565194164305, 816.8807283411466),
                new PdfPoint(879.8800214197912, 565.0798503944818),
                false
            },
            new object[]
            {
                CreateLine(920.2239969565595, 955.4757483194502, 87.53241505665954, 737.6308188768451),
                new PdfPoint(635.287776486403, 880.9320490756819),
                true
            },
            new object[]
            {
                CreateLine(920.2239969565595, 955.4757483194502, 87.53241505665954, 737.6308188768451),
                new PdfPoint(427.95040419243037, 826.6894024343649),
                true
            },
            new object[]
            {
                CreateLine(920.2239969565595, 955.4757483194502, 87.53241505665954, 737.6308188768451),
                new PdfPoint(503.2387690790675, 846.3859970596606),
                true
            },
            new object[]
            {
                CreateLine(920.2239969565595, 955.4757483194502, 87.53241505665954, 737.6308188768451),
                new PdfPoint(586.1764389770948, 868.0837675665344),
                true
            },
            new object[]
            {
                CreateLine(920.2239969565595, 955.4757483194502, 87.53241505665954, 737.6308188768451),
                new PdfPoint(620.6563911907152, 877.1042535669123),
                true
            },
            new object[]
            {
                CreateLine(435.4419130036967, 850.5098803229848, 159.36550758878843, 605.4023860909368),
                new PdfPoint(208.10755273346913, 648.6767851878215),
                true
            },
            new object[]
            {
                CreateLine(435.4419130036967, 850.5098803229848, 159.36550758878843, 605.4023860909368),
                new PdfPoint(228.9831166840324, 667.2106296969658),
                true
            },
            new object[]
            {
                CreateLine(435.4419130036967, 850.5098803229848, 159.36550758878843, 605.4023860909368),
                new PdfPoint(577.4387787996159, 976.5782269161512),
                false
            },
            new object[]
            {
                CreateLine(435.4419130036967, 850.5098803229848, 159.36550758878843, 605.4023860909368),
                new PdfPoint(611.2123737032528, 1006.5632638685038),
                false
            },
            new object[]
            {
                CreateLine(435.4419130036967, 850.5098803229848, 159.36550758878843, 605.4023860909368),
                new PdfPoint(379.0679584366007, 800.4596823601203),
                true
            },
            new object[]
            {
                CreateLine(507.82300452372095, 35.72278522161165, 84.8313841278846, 712.4995537356082),
                new PdfPoint(173.4190798939672, 570.7612979882123),
                true
            },
            new object[]
            {
                CreateLine(507.82300452372095, 35.72278522161165, 84.8313841278846, 712.4995537356082),
                new PdfPoint(642.7112490790753, -180.0952732431631),
                false
            },
            new object[]
            {
                CreateLine(507.82300452372095, 35.72278522161165, 84.8313841278846, 712.4995537356082),
                new PdfPoint(128.40790962089238, 642.7781250259156),
                true
            },
            new object[]
            {
                CreateLine(507.82300452372095, 35.72278522161165, 84.8313841278846, 712.4995537356082),
                new PdfPoint(501.6909225340208, 45.53397398551317),
                true
            },
            new object[]
            {
                CreateLine(507.82300452372095, 35.72278522161165, 84.8313841278846, 712.4995537356082),
                new PdfPoint(270.17908722494417, 415.9475335416062),
                true
            },
            new object[]
            {
                CreateLine(280.50694423074117, 252.14611393698237, 145.53561891893497, 568.107098493182),
                new PdfPoint(211.2484535339859, 414.2767061858906),
                true
            },
            new object[]
            {
                CreateLine(280.50694423074117, 252.14611393698237, 145.53561891893497, 568.107098493182),
                new PdfPoint(25.356117756651287, 849.4411775872887),
                false
            },
            new object[]
            {
                CreateLine(280.50694423074117, 252.14611393698237, 145.53561891893497, 568.107098493182),
                new PdfPoint(213.53269282688228, 408.929418572924),
                true
            },
            new object[]
            {
                CreateLine(280.50694423074117, 252.14611393698237, 145.53561891893497, 568.107098493182),
                new PdfPoint(204.19885721271936, 430.77945141155595),
                true
            },
            new object[]
            {
                CreateLine(280.50694423074117, 252.14611393698237, 145.53561891893497, 568.107098493182),
                new PdfPoint(289.8998637552519, 230.15776867945863),
                false
            }
        };
        #endregion

        [Fact]
        public void OriginIsZero()
        {
            var origin = CreateLine(0, 0, 0, 0);

            Assert.Equal(0, origin.From.X);
            Assert.Equal(0, origin.From.Y);
            Assert.Equal(0, origin.To.X);
            Assert.Equal(0, origin.To.Y);
        }

        [Theory]
        [MemberData(nameof(LengthData))]
        public void Length(double[] points, double[] expected)
        {
            Assert.Equal(expected[0], CreateLine(points[0], points[1], points[2], points[3]).Length, 6);
        }

        [Theory]
        [MemberData(nameof(IntersectsWithData))]
        public void IntersectsWith(Line source, Line other, bool expected)
        {
            var result = source.IntersectsWith(other);
            Assert.Equal(expected, result);
        }

        [Theory]
        [MemberData(nameof(IntersectData))]
        public void Intersect(Line source, Line other, PdfPoint? expected)
        {
            var result = source.Intersect(other);
            if (!expected.HasValue)
            {
                Assert.Null(result);
            }
            else
            {
                Assert.Equal(expected.Value, result.Value, PointComparer);
            }
        }

        [Theory]
        [MemberData(nameof(ContainsData))]
        public void Contains(Line source, PdfPoint other, bool expected)
        {
            var result = source.Contains(other);
            Assert.Equal(expected, result);
        }

        [Fact]
        public void ParallelTo()
        {
            // TO DO: IMPROVE

            var verticalLine1 = CreateLine(10, 7.5d, 10, 15);
            var verticalLine2 = CreateLine(200, 0, 200, 551.5467d);
            var horizontalLine1 = CreateLine(10, 7.5d, 26.3d, 7.5d);
            var horizontalLine2 = CreateLine(27, 57, 200.9999872d, 57);
            var obliqueLine1 = CreateLine(10, 7.5d, 26.3d, 12);
            var obliqueLine2 = CreateLine(60, 28.8036809815951d, 40, 23.2822085889571d);

            Assert.True(verticalLine1.ParallelTo(verticalLine2));
            Assert.True(verticalLine2.ParallelTo(verticalLine1));

            Assert.False(obliqueLine1.ParallelTo(verticalLine2));
            Assert.False(verticalLine2.ParallelTo(obliqueLine1));

            Assert.False(obliqueLine1.ParallelTo(verticalLine1));
            Assert.False(verticalLine1.ParallelTo(obliqueLine1));

            Assert.True(horizontalLine1.ParallelTo(horizontalLine2));
            Assert.True(horizontalLine2.ParallelTo(horizontalLine1));

            Assert.False(obliqueLine1.ParallelTo(horizontalLine1));
            Assert.False(horizontalLine1.ParallelTo(obliqueLine1));

            Assert.False(obliqueLine1.ParallelTo(horizontalLine2));
            Assert.False(horizontalLine2.ParallelTo(obliqueLine1));

            Assert.False(verticalLine1.ParallelTo(horizontalLine2));
            Assert.False(horizontalLine2.ParallelTo(verticalLine1));

            Assert.False(verticalLine2.ParallelTo(horizontalLine2));
            Assert.False(horizontalLine2.ParallelTo(verticalLine2));

            Assert.True(obliqueLine1.ParallelTo(obliqueLine2));
            Assert.True(obliqueLine2.ParallelTo(obliqueLine1));
        }
    }
}
